package com.modular.event.opt;

import cn.hutool.core.lang.Opt;
import com.modular.event.bean.AlarmEventDO;
import com.c.opt.ComOpt;
import ntd.util.config.common.exception.ComException;

/**
 * @author: liuwenju
 * @date: 2023/6/5 13:28
 * @version: 1.0
 */
public class OptAlarmEvent extends ComOpt<AlarmEventDO> {

    public OptAlarmEvent() {
        super("alarm_event");
    }

    public AlarmEventDO getByCode(String code) {
        return query().eq("code", Opt.ofBlankAble(code).orElseThrow(() -> new ComException("code 不能为空..."))).getBean();
    }
}
